//
//  D_1ViewController.m
//  RACExamale
//
//  Created by cym_bj on 2017/12/1.
//  Copyright © 2017年 com.cym. All rights reserved.
//

#import "D_1ViewController.h"
#import <ReactiveObjC/ReactiveObjC.h>

@interface D_1ViewController ()

@end

@implementation D_1ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.navigationItem.title=@"liftSelector";
    
    
    /*
     
     //当一个界面有多个请求时候，需要保证全部都请求完成，统一处理
     
     
     */
    
    //请求1
    
    RACSignal *signal1=[RACSignal createSignal:^RACDisposable * _Nullable(id<RACSubscriber>  _Nonnull subscriber) {
       
        NSLog(@"请求数据 一");
        [subscriber sendNext:@"发送数据一"];
        
        return nil;
    }];
    
    //请求2
    RACSignal *signal2=[RACSignal createSignal:^RACDisposable * _Nullable(id<RACSubscriber>  _Nonnull subscriber) {
       
        NSLog(@"请求数据 二");
        [subscriber sendNext:@"发送数据二"];
        return nil;
    }];
    
    //请求3
    RACSignal *signal3=[RACSignal createSignal:^RACDisposable * _Nullable(id<RACSubscriber>  _Nonnull subscriber) {
        
        NSLog(@"请求数据 三");
        [subscriber sendNext:@"发送数据三"];
        return nil;
    }];
    
    /*
     
     数组:存放信号
     
     当数组中的所在信号都发送数据的时候，才会执行Selector
     
     方法的参数: 必须跟数组的信号 一一 对应
     
     方法的参数:  就是每一个信号发送的的数据
     
     
     
     */
    
    
    
    [self rac_liftSelector:@selector(getQueueData:data2:data3:) withSignalsFromArray:@[signal1,signal2,signal3]];
    
    
    
}
#pragma msrk- 获取的数据
-(void)getQueueData:(NSString*)data1 data2:(NSString*)data2 data3:(NSString*)data3
{
    
    NSLog(@"%@ %@ %@",data1,data2,data3);
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
